const Router = require('koa-router')
const { FollowUser } = require('../../models/followUser')
const { Auth } = require('../../core/middleware/auth')
const router = new Router({
  prefix: '/v1/follow',
})
router.post('/followUser', new Auth().m, async (ctx, next) => {
  const info = {
    userid: ctx.auth.id,
    followuserid: ctx.request.body.followuserid
  }
  // 返回true关注成功,false已关注
  const res = await FollowUser.findOrCreateFollowUser(info)
  ctx.body = {
    code: 200,
    data: res,
  }
})
module.exports = router
